import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.Charset;

public class FilelRead {
    public static void main(String[] args) {
        File file = new File("E:\\IO流练习\\InoutStream\\utf8.txt");
        try (FileReader reader = new FileReader(file,Charset.forName("utf8"))
        ){
            //           int c = reader.read();
//            System.out.println((char) c);
            char[] chars = new char[20];
//            int read = reader.read(chars, 2, 15);
//            System.out.println(new String(chars, 2, read));
            int read1 = reader.read(chars, 2, 10);
            System.out.println(new String(chars, 2, read1));
            System.out.println(reader.getEncoding());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
